package com.example.xiaoxing.lashou.fragment;


import android.content.Intent;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.xiaoxing.lashou.Activity.cityActivity;
import com.example.xiaoxing.lashou.Activity.mapActivity;
import com.example.xiaoxing.lashou.Activity.searchActivity;
import com.lidroid.xutils.ViewUtils;
import com.example.xiaoxing.lashou.R;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

/**
 * Created by xiaoxing on 2017/8/1.
 */

public class fragmentIndex extends Fragment {
    @ViewInject(R.id.city)
    private TextView city;
    @ViewInject(R.id.map)
    private ImageView map;
    @ViewInject(R.id.search)
    private ImageView search;
    @Override
    public View onCreateView(LayoutInflater inflater,  ViewGroup container, Bundle savedInstanceState) {
       View view=LayoutInflater.from(getActivity()).inflate(R.layout.frag_index,null);
        ViewUtils.inject(this,view);
        return view;
    }
    @OnClick({R.id.city,R.id.map,R.id.search})
    public void OnClick(View v){
        switch (v.getId()){
        case R.id.city:
            startActivity(new Intent(getActivity(),cityActivity.class));
            break;
            case R.id.map:
                startActivity(new Intent(getActivity(),mapActivity.class));
                break;
            case R.id.search:
                startActivity(new Intent(getActivity(),searchActivity.class));
                break;

    }
    }



    @Override
    public void setMenuVisibility(boolean menuVisible){
        super.setMenuVisibility(menuVisible);
        if(this.getView()!=null){
            this.getView().setVisibility(menuVisible?View.VISIBLE:View.GONE);
        }
    }
}
